import React, { Component } from 'react';
import { connect } from 'dva';
import { Flex } from 'antd-mobile';
import MyHeader from './myHeader';
import MyOrder  from './myOrder';
import StoreInformation from './StoreInformation';
import MyWallet from './myWallet';
import MyActivity from './myActivity';
import NecessaryTools from './necessaryTools';
import MyScroll from '../../components/MyScroll/MyScroll';
import NavBottomBar from '../../components/NavBottomBar/NavBottomBar';
import "./my.less";


class My extends Component {
  constructor(props) {
    super(props);
    this.state = {
        detaList:[]
    };
  }

    getAlloyTouch = (AT) =>{
        this.AlloyTouch = AT;
    };
  render() {
      const {dispatch} = this.props;
      const {detaList=[], YE=''} = this.props.my;
      const token = localStorage.getItem('token');console.log(detaList.haveStore)
    return (
      <Flex style={{
          height:"100%"
      }} direction="column">
          <MyScroll getAlloyTouch={ this.getAlloyTouch } aa={true}>
              <MyHeader data={detaList} token={token}/>
              {detaList.haveStore ==1? <StoreInformation dispatch={dispatch} data={detaList} token={token}></StoreInformation>:""}
              <MyOrder data={detaList} token={token}/>
              <MyWallet data={detaList} YE={YE} token={token}/>
              <MyActivity  dispatch={dispatch}/>
              <NecessaryTools token={token}/>
          </MyScroll>
              <NavBottomBar path="/my" />
      </Flex>
    );
  }
}


export default connect(({ my }) => ({ my }))(My);
